package com.boge.core.model.entity;

import javax.persistence.*;

@Entity
@Table(name = "user_lock", schema = "bogege")
public class UserLock {
    private int userLockId;
    private int userId;
    private int userLockCount;
    private User user;

    @Id
    @Column(name = "user_lock_id")
    public int getUserLockId() {
        return userLockId;
    }

    public void setUserLockId(int userLockId) {
        this.userLockId = userLockId;
    }

    @Basic
    @Column(name = "user_id")
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "user_lock_count")
    public int getUserLockCount() {
        return userLockCount;
    }

    public void setUserLockCount(int userLockCount) {
        this.userLockCount = userLockCount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserLock userLock = (UserLock) o;

        if (userLockId != userLock.userLockId) return false;
        if (userId != userLock.userId) return false;
        if (userLockCount != userLock.userLockCount) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = userLockId;
        result = 31 * result + userId;
        result = 31 * result + userLockCount;
        return result;
    }

    @OneToOne
    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false)
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}
